﻿using System;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;

namespace lapinou_game2
{
    class Menu
    {
        Sprite menu;
        Sprite btn_demo_over, btn_demo_link;
        Sprite btn_mapeditor_over, btn_mapeditor_link;
        Sprite btn_exit_over, btn_exit_link;

        ContentManager Content;

        int winWidth;
        int winHeight;

        public Menu(ContentManager Content, int winWidth, int winHeight)
        {
            this.winWidth = winWidth;
            this.winHeight = winHeight;
            this.Content = Content;

            menu = new Sprite(Vector2.Zero);
            
            // DEMO JEU
            btn_demo_link = new Sprite(344, 368);
            btn_demo_over = new Sprite(344, 368);

            // EDITEUR
            btn_mapeditor_link = new Sprite(344, 463);
            btn_mapeditor_over = new Sprite(344, 463);

            // QUITTER
            btn_exit_link = new Sprite(344, 560);
            btn_exit_over = new Sprite(344, 560);
        }


        public void loadMenu()
        {
            menu.LoadContent(Content, "image/menu"); // image de fond
            
            // DEMO JEU
            btn_demo_over.LoadContent(Content, "image/menu/btn_demo_over"); // bouton survolé
            btn_demo_link.LoadContent(Content, "image/menu/btn_demo_link"); // bouton non survolé


            // EDITEUR
            btn_mapeditor_over.LoadContent(Content, "image/menu/btn_mapeditor_over");
            btn_mapeditor_link.LoadContent(Content, "image/menu/btn_mapeditor_link");

            // QUITTER
            btn_exit_over.LoadContent(Content, "image/menu/btn_exit_over");
            btn_exit_link.LoadContent(Content, "image/menu/btn_exit_link");
        }


        public void drawMenu(SpriteBatch spriteBatch, string button_over)
        {
            menu.Draw(spriteBatch);

            switch (button_over)
            {
                case "demo":
                    btn_demo_over.Draw(spriteBatch);
                    btn_mapeditor_link.Draw(spriteBatch);
                    btn_exit_link.Draw(spriteBatch);
                    break;

                case "map_editor":
                    btn_demo_link.Draw(spriteBatch);
                    btn_mapeditor_over.Draw(spriteBatch);
                    btn_exit_link.Draw(spriteBatch);
                    break;

                case "exit":
                    btn_demo_link.Draw(spriteBatch);
                    btn_mapeditor_link.Draw(spriteBatch);
                    btn_exit_over.Draw(spriteBatch);
                    break;

                default:
                    btn_demo_link.Draw(spriteBatch);
                    btn_mapeditor_link.Draw(spriteBatch);
                    btn_exit_link.Draw(spriteBatch);
                    break;
            }
        }


        public void setWinSizes(int winWidth, int winHeight)
        {
            this.winWidth = winWidth;
            this.winHeight = winHeight;
        }

    }
}